import 'package:flutter_project/tool/network/http/code/http_api.dart';

class DZHttpPostApi implements BaseApi {
  DZHttpPostApi(String api, Map<String, dynamic>? params) {
    _api = api;
    if (params != null) {
      _params = params;
    } else {
      _params = <String, dynamic>{};
    }
  }
  late String _api;
  late Map<String, dynamic> _params;
  @override
  String? get baseUrl => _api;

  @override
  HttpCacheType get cache => HttpCacheType.none;

  @override
  Map<String, dynamic>? get header => null;

  @override
  HttpRequestLoginPolicy get loginPolicy => HttpRequestLoginPolicy.soft;

  @override
  Method get method => Method.post;

  @override
  Map<String, dynamic> params() {
    return _params;
  }

  @override
  String path() {
    return _api;
  }

  @override
  bool get showLoading => true;

  @override
  HttpResponseType get responseType => HttpResponseType.json;
}

class DZHttpGetApi implements HttpApi {
  DZHttpGetApi(String api, Map<String, dynamic>? params) {
    _api = api;
    if (params != null) {
      _params = params;
    } else {
      _params = <String, dynamic>{};
    }
  }
  late String _api;
  late Map<String, dynamic> _params;
  @override
  String? get baseUrl => _api;

  @override
  HttpCacheType get cache => HttpCacheType.none;

  @override
  Map<String, dynamic>? get header => null;

  @override
  HttpRequestLoginPolicy get loginPolicy => HttpRequestLoginPolicy.soft;

  @override
  Method get method => Method.get;

  @override
  Map<String, dynamic> params() {
    return _params;
  }

  @override
  String path() {
    return _api;
  }

  @override
  bool get showLoading => true;

  @override
  HttpResponseType get responseType => HttpResponseType.json;
}
